add_rules("mode.debug","mode.release")
option("demo")
	set_default(false)
	set_showmenu(true)
option("demo_path")
	set_showmenu(true)
if is_mode("debug") then

    -- 添加DEBUG编译宏
    add_defines("DEBUG")
    -- 启用调试符号
    set_symbols("debug")

    -- 禁用优化
    set_optimize("none")
end



includes("src/*.lua")
if has_config("demo") then
	target("main")
		set_kind("binary")
		add_deps("libcell")
		set_targetdir("bin")
		add_files("$(demo_path)/*.cpp","$(demo_path)/*.c") 
		add_includedirs("$(demo_path)","$(demo_path)/include","include",
			"thirdpart/cstructures/include","thirdpart/eigen/Eigen","thirdpart/lbmath/include",
			"thirdpart")
		--add_links("libcell","cstructures","cstruct_iterator")
		add_linkdirs("libs","temp_libs") 
		if is_plat("linux") then

			add_ldflags("-pthread -lphread")
			add_cxflags("-O3 -std=c++11 -pthread")
			add_cxxflags("-O3 -std=c++11 -pthread")
			add_syslinks("lbmath","cstructures","pthread")

        elseif is_plat("mingw") then
           	add_ldflags("-pthread -lphread")
			add_cxflags("-O3 -std=c++11 -pthread")
			add_cxxflags("-O3 -std=c++11 -pthread")
			add_syslinks("lbmath","cstructures","pthread")
			
        else 
            print("not mingw")
            add_cxflags("/MD /O2 /bigobj ")
        	add_ldflags("/LTCG ")
          	add_syslinks("lbmath","cstructures", "msvcrt")

        end
		
		on_load(function  (target)
			print("$(demo_path)")
		end)
end